<template>
<div class="breadcrumb">
 <el-breadcrumb separator-class="el-icon-arrow-right">
      <!-- 默认样式紧挨着，这里的el-breadcrumb设置在全局样式文件 global.css中 -->
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片主体区域 -->
    <el-card class="box-card">
        <!-- 信息展示部分 -->
      <el-table :data="authList" border stripe>
        <!-- border：显示边框   stripe：隔行变色 -->
        <el-table-column type="index" lable="#"></el-table-column>
        <el-table-column prop="authName" label="权限名称"> </el-table-column>
        <el-table-column prop="path" label="路径"> </el-table-column>
        <el-table-column prop="level" label="权限等级"> 
            <template slot-scope="scope">
                <el-tag v-if="scope.row.level ==='0'">一级</el-tag>
                <el-tag type="success" v-if="scope.row.level ==='1'">二级</el-tag>
                <el-tag type="warning" v-if="scope.row.level ==='2'">三级</el-tag>
            </template>
        </el-table-column>
      </el-table>
    </el-card>
 </div>
</template>

<script>
export default {
 data() {
  return {
      authList:[]
  }
 },
 created(){
     this.getRoleList();
 },
 methods: {
     async getRoleList(){
        const { data: res } = await this.$http.get("rights/list");
        if(res.meta.status != 200){
            this.$message.error('权限获取失败！');
        }
        this.authList = res.data
     }
 }
}
</script>

<style scoped lang="less">
</style>
